from math import pi, sqrt
from random import *

def cairo_draw( cr, w, h ):
	def draw_circle( x, y, r ):
		arc = 2.0*pi
		cr.move_to(x+r, y)
		cr.arc( x, y, r, 0, arc)
		xd, yd = ( random()*r/10, random()*r/10 )
		cr.move_to(x+2*r/3 + xd, y + yd)
		cr.arc( x + xd, y + yd, 2*r/3, 0, arc)
		cr.move_to(x+r/3, y)
		cr.arc( x, y, r/3, 0, arc)
		cr.stroke() 

	seed()
	d = w/20
	cr.set_source_rgb(0, 0,0)
	for r in range(0,h/d):
		for c in range(0,w/d):
			draw_circle( c*d, r*d, d/2 )

	return 
